package com.wyw.hemerocallis.repository;

import com.wyw.hemerocallis.constant.BrandCategory;
import com.wyw.hemerocallis.constant.GoodsCategory;
import com.wyw.hemerocallis.entity.HemerocallisGoods;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

/**
 * 类/方法简述
 *
 * @author Mr Wu    yewen.wu.china@gmail.com
 * <p>
 * Update History:
 * Author        Time            Content
 */
public interface HemerocallisGoodsRepository extends JpaRepository<HemerocallisGoods, Long> {

    /**
     * 根据查询条件查询商品表, 并限制返回结果
     * select * from hemerocallis_goods where goods_category = ? and brand_category = ?
     * and goods_name = ? limit 1;
     * */
    Optional<HemerocallisGoods> findFirstByGoodsCategoryAndBrandCategoryAndGoodsName(
            GoodsCategory goodsCategory, BrandCategory brandCategory, String goodsName
    );

}
